﻿#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

long long my_gcd(long long a, long long b)
{
    while (b != 0)
    {
        long long tmp = b;
        b = a % b;
        a = tmp;
    }
    return a;
}

int main() {
    int n;
    long long x;
    cin >> n >> x;
    for (int i = 0; i < n; i++)
    {
        long long a;
        cin >> a;
        if (x >= a) x += a;
        else x += my_gcd(x, a);
    }
    cout << x;
    return 0;
}